package model;

import java.io.Serializable;
import java.util.Objects;

public class User implements Serializable {

    private String userName;
    private String userNickName;
    private String userEmail;
    private String userPassword;
    private boolean userPrivileged;

    public User() {
    }

    public User(String name, String nickName, String email, String password, boolean privileged) {
        userName = name;
        userNickName = nickName;
        userEmail = email;
        userPassword = password;
        userPrivileged = privileged;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserNickName() {
        return userNickName;
    }

    public void setUserNickName(String userNickName) {
        this.userNickName = userNickName;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    public String getUserEmail() {
        return userEmail;
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }

    public boolean isUserPrivileged() {
        return userPrivileged;
    }

    public void setUserPrivileged(boolean userPrivileged) {
        this.userPrivileged = userPrivileged;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final User other = (User) obj;
        if (!Objects.equals(this.userName, other.userName)) {
            return false;
        }
        if (!Objects.equals(this.userNickName, other.userNickName)) {
            return false;
        }
        if (!Objects.equals(this.userEmail, other.userEmail)) {
            return false;
        }
        if (!Objects.equals(this.userPassword, other.userPassword)) {
            return false;
        }
        if (this.userPrivileged != other.userPrivileged) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 79 * hash + Objects.hashCode(this.userName);
        hash = 79 * hash + Objects.hashCode(this.userNickName);
        hash = 79 * hash + Objects.hashCode(this.userEmail);
        hash = 79 * hash + Objects.hashCode(this.userPassword);
        hash = 79 * hash + (this.userPrivileged ? 1 : 0);
        return hash;
    }
}
